public class ClientClass {
    public static void main(String[] args) {
        Factory factory = new Factory();

        // 注册观察者
        factory.addObserver(new LoggingObserver());

        Fruit fruitA = factory.CreateFruit("A");
        fruitA.eat();  // 输出：eat Apple 和系统日志

        Fruit fruitB = factory.CreateFruit("B");
        fruitB.eat();  // 输出：eat Banana 和系统日志
    }
}